class Solution(object):
    def smallerNumbersThanCurrent(self, nums):
        t = [0] * 101
        n = len(nums)
        out = [0] * n
        for num in nums:
            t[num] += 1
        for i in range(100):
            t[i + 1] += t[i]
        for i in range(n):
            if nums[i] > 0:
                out[i] = t[nums[i] - 1]
        return out

